import { Component, OnInit } from '@angular/core';
import { StoreService } from 'src/services/store.service';
import { UiService } from 'src/services/ui.service';

@Component({
  selector: 'app-entitylist',
  templateUrl: './entitylist.component.html',
  styleUrls: ['./entitylist.component.scss']
})
export class EntitylistComponent implements OnInit {

  constructor(public ui: UiService, public store: StoreService) { }

  ngOnInit(): void {
    //console.log(this.ui.entitielist);
  }
  accordionTypeEmbed = 'embed'
  restrictOneOpen = true
  log($event) {
    console.log($event);
  }
  menuToggle(event) {
    // this.ui.activelistitem = event.item.title
    // console.log(this.ui.activelistitem);
    // console.log('menu toggle' + JSON.stringify(event));

    // if (event.open && event.item.needLoadChildren) {
    //   event.item.loading = true;
    //   setTimeout(() => {
    //     event.item.children = [
    //       { title: 'Child Content 1' },
    //       { title: 'Child Content 2' }
    //     ];
    //     event.item.needLoadChildren = false;
    //     event.item.loading = false;
    //   }, 1000);
    // }
  }
  itemClick($event) {
    console.log('item click' + JSON.stringify(event));
  }
  select(item, t) {
    console.log(item);
    console.log(t);
    this.store.currentEntity = item
    if (t == 'panorama' || t === 'express')
      this.ui.openinfo(item.Name, t, item)
    else
      this.ui.openinfo(item.Id, t, item)
  }
  active(item) {
    console.log(item);
    this.ui.activePanel = item
  }


}
